/* 
 * File:   ObjParser.h
 * Author: brady
 *
 * Created on August 27, 2011, 1:31 PM
 */

#ifndef OBJPARSER_H
#define	OBJPARSER_H

#include <iostream>
#include <fstream>
#include <string>
#include <shapes/TriangleMesh.h>
#include <obj/obj.hpp>
#include <obj/obj_parser.hpp>
#include <vector>
#include <map>

using namespace std;
using namespace obj;

class ObjParser {
public:
    ObjParser();
    ObjParser(const ObjParser& orig);
    virtual ~ObjParser();
    static TriangleMesh* parseObj(const char* fileName);
    static vector<TriangleMesh*> parseObj2(const char* fileName);
    static vector<Vertex*> verts;
    static vector<Vector3D> normals;
    static vector<Vector3D> textureCoords;
    static vector<TriangleMesh*> meshes;
    static int meshCount;
    static std::string currentMtl;
    

    
private:
    static void material_name_callback(std::string mtlName);
    static void geometric_vertex_callback(float_type x, float_type y,float_type z);
    static void vertex_normal_callback(float_type x, float_type y, float_type z);
    static void texture_coord_callback(float_type x, float_type y);
    static void triangle_face_vertices_callback(index_type v1, index_type v2, index_type v3 );
    static void triangle_face_vertices_normals_callback(index_2_tuple_type v1, index_2_tuple_type v2, index_2_tuple_type v3);
    static void triangle_face_vertices_textureCoords_callback(index_2_tuple_type v1, index_2_tuple_type v2, index_2_tuple_type v3 );
    static void triangle_face_vertices_textureCoords_normals_callback(index_3_tuple_type v1, index_3_tuple_type v2, index_3_tuple_type v3);
    static void quad_face_vertices_callback(index_type v1, index_type v2, index_type v3, index_type v4 );
    static void quad_face_vertices_normals_callback(index_2_tuple_type v1, index_2_tuple_type v2, index_2_tuple_type v3, index_2_tuple_type v4);
    static void quad_face_vertices_textureCoords_callback(index_2_tuple_type v1, index_2_tuple_type v2, index_2_tuple_type v3, index_2_tuple_type v4);
    static void quad_face_vertices_textureCoords_normals_callback(index_3_tuple_type v1, index_3_tuple_type v2, index_3_tuple_type v3, index_3_tuple_type v4);
    static void cleanup();
};
#endif	/* OBJPARSER_H */

